import Vue from 'vue'
import App from './App.vue'

//element-ui
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from "axios";
import QS from 'qs';

//引入路由
import VueRouter from "vue-router";
import router from "./router"

//引入weui
import weui from 'weui.js'
import 'weui'

Vue.use(ElementUI);
//使用路由
Vue.use(VueRouter)
Vue.prototype.$qs = QS;

import ViewUI from 'view-design';
import 'view-design/dist/styles/iview.css';

Vue.use(ViewUI);
Vue.prototype.$axios = axios
Vue.prototype.$weui = weui
Vue.config.productionTip = false

axios.defaults.withCredentials = true

//使用push的方法
const RouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
  return RouterPush.call(this, to).catch(err => err)
}

//使用replace的方法
const RouterReplace = VueRouter.prototype.replace
VueRouter.prototype.replace = function replace (to) {
  return RouterReplace.call(this, to).catch(err => err)
}


new Vue({
  render: h => h(App),
  router: router,
}).$mount('#app')
